package top.hjcwzx.wrench.design.framework.service.link.prototype.factory;

import lombok.*;
import org.springframework.stereotype.Service;
import top.hjcwzx.wrench.design.framework.link.prototype.LinkArmory;
import top.hjcwzx.wrench.design.framework.link.prototype.chain.BusinessLinkedList;
import top.hjcwzx.wrench.design.framework.model.link.prototype.LogicPrototypeReq;
import top.hjcwzx.wrench.design.framework.model.link.prototype.LogicPrototypeRes;
import top.hjcwzx.wrench.design.framework.service.link.prototype.logic.TestPrototypeRuleLogic01;
import top.hjcwzx.wrench.design.framework.service.link.prototype.logic.TestPrototypeRuleLogic02;
import top.hjcwzx.wrench.design.framework.service.link.prototype.logic.TestPrototypeRuleLogic03;

@Service
@RequiredArgsConstructor
public class DefaultProtoTestRuleLogicFactory {

    private final TestPrototypeRuleLogic01 ruleLogic01;
    private final TestPrototypeRuleLogic02 ruleLogic02;
    private final TestPrototypeRuleLogic03 ruleLogic03;

    public BusinessLinkedList<LogicPrototypeReq, DynamicContext, LogicPrototypeRes> openLogicLink() {

        LinkArmory<LogicPrototypeReq, DynamicContext, LogicPrototypeRes> armory =
                new LinkArmory<>("test01", ruleLogic01, ruleLogic02,ruleLogic03);

        return armory.getLogicLink();
    }

    public BusinessLinkedList<LogicPrototypeReq, DynamicContext, LogicPrototypeRes> openLogicLink2() {

        LinkArmory<LogicPrototypeReq, DynamicContext, LogicPrototypeRes> armory =
                new LinkArmory<>("test02", ruleLogic01, ruleLogic03);

        return armory.getLogicLink();
    }

    @Data
    @Builder
    @AllArgsConstructor
    @NoArgsConstructor
    public static class DynamicContext {

        private String field;

    }

}
